﻿using Domain.Models;
using IServices;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using ViewModel.Response;

namespace Management.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class PermissionController : BaseController
    {
        private readonly IPermissionService permissionService;

        public PermissionController(
            ILogger logger,
            IPermissionService permissionService) : base(logger)
        {
            this.permissionService = permissionService;
        }

        /// <summary>
        /// 获取所有权限
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ResponseModel<IEnumerable<Permission>> Get()
        {
            var result = new ResponseModel<IEnumerable<Permission>>
            {
                Status = ResponseStatus.OK,
                Data = this.permissionService.Query()
            };
            return result;
        }

    }
}